package com.nutiteq.mapper.forms;

import java.io.IOException;

import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

import com.nutiteq.components.Point;
import com.nutiteq.ui.Cursor;

public class FingerCursor implements Cursor {
  private Image cursor;
  private static final int CURSOR_SIZE = 16;

  public FingerCursor() {
    try {
      cursor = Image.createImage("/finger.png");
    } catch (final IOException ignore) {
    }
  }

  public void paint(final Graphics g, final int screenX, final int screenY, final int displayWidth,
      final int displayHeight) {
    g.setClip(screenX, screenY - CURSOR_SIZE, CURSOR_SIZE, CURSOR_SIZE);
    g.drawImage(cursor, screenX, screenY, Graphics.LEFT | Graphics.BOTTOM);
  }

  public Point getPointOnDisplay(final int displayWidth, final int displayHeight) {
    return new Point(displayWidth / 2, displayHeight / 2);
  }
}
